drop sequence IMPORT_LOCATION_SEQ;
create sequence IMPORT_LOCATION_SEQ
minvalue 0
maxvalue 9999999999999999
start with 0
increment by 1
nocache
;

drop sequence CLASS_SEQ;
create sequence CLASS_SEQ
minvalue 0
maxvalue 9999999999999999
start with 0
increment by 1
nocache
;

drop sequence CLASS_IMPLEMENTS_SEQ;
create sequence CLASS_IMPLEMENTS_SEQ
minvalue 0
maxvalue 9999999999999999
start with 0
increment by 1
nocache
;

drop sequence METHOD_SEQ;
create sequence METHOD_SEQ
minvalue 0
maxvalue 9999999999999999
start with 0
increment by 1
nocache
;

create or replace trigger IMPORT_LOCATION_ID_TGR
  before insert on import_location
  for each row
declare
begin
    IF :new.IMPORT_LOCATION_ID IS NULL THEN
        SELECT IMPORT_LOCATION_SEQ.nextval INTO :new.IMPORT_LOCATION_ID FROM DUAL;
    END IF;
end IMPORT_LOCATION_ID_TGR;
/

create or replace trigger CLASS_ID_TGR
  before insert on class
  for each row
declare
begin
    IF :new.CLASS_ID IS NULL THEN
        SELECT CLASS_SEQ.nextval INTO :new.CLASS_ID FROM DUAL;
    END IF;
end CLASS_ID_TGR;
/

create or replace trigger CLASS_IMPLEMENTS_ID_TGR
  before insert on CLASS_IMPLEMENTS
  for each row
declare
begin
    IF :new.IMPLEMENTS_ID IS NULL THEN
        SELECT CLASS_IMPLEMENTS_SEQ.nextval INTO :new.IMPLEMENTS_ID FROM DUAL;
    END IF;
end CLASS_IMPLEMENTS_ID_TGR;
/

create or replace trigger METHOD_ID_TGR
  before insert on METHOD
  for each row
declare
begin
    IF :new.METHOD_ID IS NULL THEN
        SELECT METHOD_SEQ.nextval INTO :new.METHOD_ID FROM DUAL;
    END IF;
end METHOD_ID_TGR;
/

create or replace procedure SP_CLEAR_DATA is
begin
    delete from method_call;
    delete from class_call;
    delete from method;
    delete from class_implements;
    delete from class;
    delete from import_location;
end SP_CLEAR_DATA;
/